package com.neu.tly.dao;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;


@Repository
public class AccountDaoImpl implements AccountDao {
	
	@Autowired
	private JdbcTemplate jdbcTemplate;

	@Override
	public void accountIn(String account, double money) {
		 String sql="update account set balance =balance+"+money+" where username='"+account+"'";
		 System.out.println(sql);
		 jdbcTemplate.update(sql);

	}

	@Override
	public void accountOut(String account, double money) {
		 String sql="update account set balance =balance-"+money+" where username='"+account+"'";
		 System.out.println(sql);
		 jdbcTemplate.update(sql);

	}

}
